﻿/// <reference path="../Library/jquery-1.9.1.min.js" />

// VALIDATE APPLICATION NAMESPACE IS AVAILABLE

var Application = Application || {

    // APPLICATION NAMESPACE

};

Application.Navigation = {

    Toggle: function () {

        $('#ApplicationNavigationBar').toggle();

        $(window).resize(); // IMMEDIATE REDRAW TO SHOW NAVIGATION BAR (AND CHANGE THE "TOP" POSITION VALUE)

        setTimeout($(window).resize(), 1); // SECONDARY DRAW FOR CONTENT VIEW RESIZE

    }

}

Application.Window = {

    Width: function () { return $(window).innerWidth(); },

    Height: function () { return $(window).innerHeight(); }

}


Application.ContentView = {

    Top: function () { return $("#ApplicationContent").offset().top; },

    Width: function () { return $("#ApplicationContent").outerWidth(); },

    Height: function () { return $("#ApplicationContent").outerHeight(); }

};


function ApplicationTitleBarLinkClose_OnClick() {

    try {

        window.close (); 

        window.opener().focus ();

    }

    catch (exception) { /* DO NOTHING */ }

    return false; 

}

$(document).ready(function () {

    // DETERMINE IF THE WINDOW IS A CHILD WINDOW THAT CAN BE CLOSED 

    if (window.opener != null) {

        $("#ApplicationTitleBarLinkClose").closest("td").show();

    }

});
